package collection;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class ListDemo {
    public static void main(String[] args) {
        List<String>list=new ArrayList<>();
        list.add("one");
        list.add("two");
        list.add("three");
        list.add("four");
        list.add("five");
        for (int i=0;i< list.size();i++){
            System.out.print(list.get(i)+" ");
        }
        System.out.println();
        Iterator it = list.iterator();
        while (it.hasNext()){
            System.out.print(it.next()+" ");
        }
        System.out.println();
        for (String str:list){
            System.out.print(str+" ");
        }
        System.out.println();
        list.add(0,"zero");
        System.out.println(list);
    }
}
